package com.hospital.demo.util;

import java.util.Random;

/**
 * 随机生成10位数或字符串
 * Created by Administrator on 2019/10/15 0015.
 */
public class KeyUtils {

    public static int getRandomInt(){
        int a=(int)((Math.random()*9+1)*100000000);
        return a;
    }

    public static String getRandomString(int length){
        String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random random=new Random();
        StringBuffer sb=new StringBuffer();
        for(int i=0;i<length;i++){
            int number=random.nextInt(62);
            sb.append(str.charAt(number));
        }
        return sb.toString();
    }
}
